#include <stdio.h>
   #include <libpq-fe.h>
   int main() {
       PGconn *conn;
       PGresult *res;
       char *host = "myhost";
       char *port = "myport";
       char *dbname = "mydb";
       char *user = "myuser";
       char *password = "mypassword";
       conn = PQsetdbLogin(host, port, NULL, NULL, dbname, user, password);
       if (PQstatus(conn) != CONNECTION_OK) {
           printf("Connection to database failed: %s\n", PQerrorMessage(conn));
           PQfinish(conn);
           return 1;
       }
       res = PQexec(conn, "SELECT COUNT(*) FROM mytable WHERE ST_ValueCount(rast) = ST_Value(rast, 1, 1)");
       if (PQresultStatus(res) != PGRES_TUPLES_OK) {
           printf("Query failed: %s\n", PQerrorMessage(conn));
           PQclear(res);
           PQfinish(conn);
           return 1;
       }
       int count = atoi(PQgetvalue(res, 0, 0));
       printf("密态等值查询结果：%d", count);
       PQclear(res);
       PQfinish(conn);
       return 0;
   }

